
<template>
	<div id="app">
		<topTabs v-if="$route.meta.topTabs != false" />
		<!-- <historyRoute v-if="$route.meta.historyRoute !=false"/> -->
		<leftNav v-if="$route.meta.leftNav != false"></leftNav>

		<keep-alive>
			<router-view v-if="$route.meta.keepAlive" />
		</keep-alive>
		<router-view v-if="!$route.meta.keepAlive" />
		<!-- <router-view  /> -->
		<Loading :loadingShow="$store.state.loadingShow" />
	</div>
</template>
<script>
import leftNav from '@/components/common/leftNav';
import topTabs from '@/components/common/topTabs';
import historyRoute from '@/components/common/historyRoute';
import Loading from '@/components/common/Loading';

import { routeGuard } from './assets/js/permission';
// import Vue from 'vue'
//   Vue.directives("focus", {
//     // 当被绑定的元素插入到 DOM 中时……
//     inserted: function (el) {
//       // 聚焦元素
//       el.focus();
//     },
//   });
export default {
	name: 'App',
	data() {
		return {
			dialogVisible: false,
			isLoading: false, //是否已经加载过接口
		};
	},
	created() {
		routeGuard(); //重置路由
		var token = window.localStorage.token
			? window.localStorage.token
			: '';
		this.$store.state.token = token;
		console.log(this.$route, '开始页面');
		if (this.$route.path != '/dataScreen') {//数据大屏不调用 防止token验证
			this.groupByType_basicData();
			this.list_contract();
			this.SET_MEANTOTAL(); //设置菜单待确认数量
		}
	},
	methods: {
		list_contract() {
			var params = { type: '国际' };
			this.$myApi.list_contract(params).then((res) => {
				if (res.code == 200) {
					this.$store.state.contractAllList = res.data;
				}
			});
		},
		groupByType_basicData() {
			this.$myApi.groupByType_basicData().then((res) => {
				if (res.code == 200) {
					this.$store.state.typeAllList = res.data;
				}
			});
		},
		exit() {
			this.$router.push('/');
			this.dialogVisible = false;
		},
	},

	components: {
		Loading,
		leftNav,
		topTabs,
		historyRoute,
	},
};
</script>
<style>
@import './assets/main.css';
</style>
